<extend name="Public/base" />

<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> 
		</div>
	</div>
	<div class="container-fluid">
		<br>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
		        	<div class="widget-title">
		        		
		          	</div>
		          	<div class="widget-content tab-content">
		            	<div class="tab-pane active">
		              		<form action="#" method="get" class="form-horizontal">			              		
				              	<volist name="list" id="config">
									<div class="control-group">
										<label class="control-label">{$config.title}</label>
										<div class="controls">
										<switch name="config.type">
										<case value="0">
											<input type="text" class="ui-wizard-content" name="{$config.name}" value="{$config.value|change_str}"
												placeholder="" />
										</case>
										<case value="1">
											<input type="text" class="ui-wizard-content" name="{$config.name}" value="{$config.value|change_str}"
												placeholder="" />
										</case>
										<case value="2">
										<label class="textarea input-large">
											<textarea style="resize: none; height: 100px;" name="{$config.name}" placeholder="">{$config.value|change_str}</textarea>
										</label>
										</case>
										<case value="3">
										<label class="textarea input-large">
											<textarea style="resize: none; height: 100px;" name="{$config.name}" >{$config.value|change_str}</textarea>
										</label>
										</case>
										<case value="4">
										
											<select class="form-control" style="width:120px;" name="{$config.name}">
												<volist name=":parse_config_attr($config['extra'])" id="vo">
													<option value="{$key}" <eq name="config.value" value="$key">selected</eq>>{$vo}</option>
												</volist>
											</select>
											
										</case>
										</switch>
										</div>
									</div>
								</volist>
								
								<div class="form-actions">
									<button id="submit" type="button" class="btn btn-success">保 存</button>
								</div>
							</form>
		            	</div>
		          </div>
		        </div>
			</div>
		</div>
		<div class="row-fluid"></div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	$("#submit").click(function(){
		//锁定提交按钮
	//	$(this).attr('disabled',true);
		var self = $('form');
		$.post("{:U('api')}", self.serialize(), call_back, "json");
		return false;
		/**
		 * @todo 接收登录返回值
		 * @author PHP@妖孽 <dino_ma@163.com>
		 */
		function call_back(data){
			if(data.status == 1){
				tke_alert(data.info,'alert-success');
				setTimeout(function(){
					location.reload();
					//window.location.href = data.url;
				},1000);
			} else {
				tke_alert(data.info,'alert-error');
				$(this).attr('disabled',false);
			}
		}
	});
});
</script>
</block>
